﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PSIEpics;

using System.Threading;

using jtext_EpicsClient;


namespace jec_test_monitor
{
    class Program
    {
        static void Main(string[] args)
        {
            EpicsClient ec = new EpicsClient();
            EpicsChannel ecc = ec.CreateChannel("test:CLIENTNAMEOUT");
            JECLient MyClient=new JECLient();
            MyClient.AddChannel("test:MSG_OUT_REQ");
            MyClient.AddChannel<sbyte>("test:CLIENTNAMEOUT");
            MyClient["test:MSG_OUT_REQ"].MonitorMask = MonitorMask.ALL;
            MyClient["test:MSG_OUT_REQ"].MonitorChanged += new EpicsDelegate(monitor);
            //((EpicsChannel)MyClient.ChannelList["test:MSG_OUT_REQ"]).MonitorChanged += new EpicsDelegate(monitor);
            while (true)
            {
                Console.WriteLine(MyClient["test:MSG_OUT_REQ"].Get().ToString());
                Console.WriteLine(MyClient.GetString("test:CLIENTNAMEOUT",12));
                Console.WriteLine(ecc.Get<sbyte[]>(12).ToString());

                Console.ReadLine();
            }
        }

        static private void monitor(EpicsChannel sender, object newValue)
        {
            Console.WriteLine(newValue.ToString() + "@@");
        }
    }
}
